<template>
  <div class="toast" v-show="isShow">{{message}}</div>
</template>

<script>
  export default{
    data(){
      return{
        message:'',
        isShow:false
      }
    },
    methods:{
      show(message,delay=2000){
        this.message = message;
        this.isShow = true;
        setTimeout(()=>{
          this.isShow = false;
          this.message = '';
        },delay)
      }
    }
  }
</script>

<style>
  .toast{
    position: fixed;
    z-index: 999;
    top: 50%;
    left: 50%;
    color: #FFFFFF;
    padding: 5px 10px;
    transform: translate(-50%,-50%);
    background-color:rgba(0,0,0,.7)
  }
</style>
